//
//  TYZBaseInfo.m
//  TYZ_SC
//
//  Created by 李贤立 on 2017/12/12.
//  Copyright © 2017年 Capfer. All rights reserved.
//

#import "TYZBaseInfo.h"

@implementation TYZBaseInfo
TYZSingleto_m(BaseInfo)
/**邀请*/
NSString * const DESK_TOUCH_YAOQING = @"DESK_TOUCH_YAOQING";
/**搜索*/
NSString * const DESK_TOUCH_SOUSUO  = @"DESK_TOUCH_SOUSUO";
/**写诗*/
NSString * const DESK_TOUCH_XIESHI  = @"DESK_TOUCH_XIESHI";
/**写词*/
NSString * const DESK_TOUCH_XIECI   = @"DESK_TOUCH_XIECI";
#pragma mark - 设置界面的URL
/**无线局域网*/
NSString * const APP_SETTING_WIFI = @"App-Prefs:root=WIFI";
/**蓝牙*/
NSString * const APP_SETTING_Bluetooth = @"App-Prefs:root=Bluetooth";
/**蜂窝移动网络*/
NSString * const APP_SETTING_MOBILE_DATA_SETTINGS_ID = @"App-Prefs:root=MOBILE_DATA_SETTINGS_ID";
/**个人热点*/
NSString * const APP_SETTING_INTERNET_TETHERING = @"App-Prefs:root=INTERNET_TETHERING";
/**运营商*/
NSString * const APP_SETTING_Carrier = @"App-Prefs:root=Carrier";
/**通知*/
NSString * const APP_SETTING_NOTIFICATIONS_ID = @"App-Prefs:root=NOTIFICATIONS_ID";
/**通用*/
NSString * const APP_SETTING_INTERNET_General = @"App-Prefs:root=General";
/**通用关于本机*/
NSString * const APP_SETTING_About = @"App-Prefs:root=General&path=About";
/**通用键盘*/
NSString * const APP_SETTING_Keyboard = @"App-Prefs:root=General&path=Keyboard";
/**通用辅助功能*/
NSString * const APP_SETTING_ACCESSIBILITY = @"App-Prefs:root=General&path=ACCESSIBILITY";
/**通用语言和地区*/
NSString * const APP_SETTING_INTERNET_INTERNATIONAL = @"App-Prefs:root=General&path=INTERNATIONAL";
/**墙纸*/
NSString * const APP_SETTING_Wallpaper = @"App-Prefs:root=Wallpaper";
/**Siri*/
NSString * const APP_SETTING_SIRI = @"App-Prefs:root=SIRI";
/**隐私*/
NSString * const APP_SETTING_Privacy = @"App-Prefs:root=Privacy";
/**Safari*/
NSString * const APP_SETTING_SAFARI = @"App-Prefs:root=SAFARI";
/**音乐*/
NSString * const APP_SETTING_MUSIC = @"App-Prefs:root=MUSIC";
/**音乐均衡器*/
NSString * const APP_SETTING_MUSICEQ = @"App-Prefs:root=MUSIC&path=com.apple.Music:EQ";
/**照片与相机*/
NSString * const APP_SETTING_Photos = @"App-Prefs:root=Photos";
/**FaceTime*/
NSString * const APP_SETTING_INTERNET_FACETIME = @"App-Prefs:root=FACETIME";
- (NSString *)sendBox {
    if (_sendBox == nil) {
        _sendBox = NSHomeDirectory();
    }
    return _sendBox;
}
- (NSString *)documentPath {
    if (_documentPath == nil) {
        _documentPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES) objectAtIndex:0];
    }
    return _documentPath;
}
- (NSString *)imagesFolder {
    if (_imagesFolder == nil) {
        _imagesFolder = [self.documentPath stringByAppendingPathComponent:@"Images"];
        [[NSFileManager defaultManager] createDirectoryAtPath:_imagesFolder withIntermediateDirectories:NO attributes:nil error:nil];
    }
    return _imagesFolder;
}
- (NSString *)referenceFolder {
    if (_referenceFolder == nil) {
        _referenceFolder = [self.documentPath stringByAppendingPathComponent:@"Reference"];
        [[NSFileManager defaultManager] createDirectoryAtPath:_referenceFolder withIntermediateDirectories:NO attributes:nil error:nil];
    }
    return _referenceFolder;
}
- (NSString *)exitFilePath {
    if (_exitFilePath == nil) {
        _exitFilePath = [self.documentPath stringByAppendingPathComponent:Symbol_ExistFileFolder];
        [[NSFileManager defaultManager] createDirectoryAtPath:_exitFilePath withIntermediateDirectories:NO attributes:nil error:nil];
    }
    return _exitFilePath;
}
- (NSString *)worksFilePath {
    if (_worksFilePath == nil) {
        _worksFilePath = [self.exitFilePath stringByAppendingPathComponent:Symbol_WorksFileFolder];
        [[NSFileManager defaultManager] createDirectoryAtPath:_worksFilePath withIntermediateDirectories:NO attributes:nil error:nil];
    }
    return _worksFilePath;
}
- (NSString *)collectPath {
    if (_collectPath == nil) {
        _collectPath = [self.exitFilePath stringByAppendingPathComponent:Symbol_CollectPlistFile];
    }
    return _collectPath;
}
- (NSArray *)imageArray {
    if (_imageArray == nil) {
        NSMutableArray *imageArray = [NSMutableArray arrayWithCapacity:24];
        NSString *prefix = @"loading_";
        for (int i = 0; i < 24; i ++) {
            UIImage *imgtemp = [UIImage imageNamed:[NSString stringWithFormat:@"%@%d.png", prefix, i]];
            [imageArray addObject:imgtemp];
        }
        _imageArray = [imageArray mutableCopy];
    }
    return _imageArray;
}
- (NSTimer *)countdownTimer {
    if (_countdownTimer == nil) {
        _countdownTimer = [NSTimer timerWithTimeInterval:1.0 target:self selector:@selector(timerAction) userInfo:nil repeats:YES];
    }
    return _countdownTimer;
}
- (void)timerAction {
    self.verifyCountdown ++;
}
- (void)setVerifyCountdown:(NSInteger)verifyCountdown {
    if (verifyCountdown >= Value_VerifyCountdown) {
        verifyCountdown = 0;
        [self.countdownTimer invalidate];
        self.countdownTimer = nil;
    }
    _verifyCountdown = verifyCountdown;
}
- (NSString *)sqlite {
    if (_sqlite == nil) {
        _sqlite = [self.documentPath stringByAppendingPathComponent:@"sqlite"];
    }
    return _sqlite;
}
- (NSDictionary *)err_dict {
    if (_err_dict == nil) {
        _err_dict = @{@(10139) : Request_SMSLimit,
                      @(10109) : Request_SysError,
                      @(10104) : Request_PwdError,
                      @(10119) : Request_NoOnline
                      };
    }
    return _err_dict;
}
- (NSArray<NSString *> *)settingTypeArray {
    if (_settingTypeArray == nil) {
        _settingTypeArray = @[APP_SETTING_WIFI,
                              APP_SETTING_Bluetooth,
                              APP_SETTING_MOBILE_DATA_SETTINGS_ID,
                              APP_SETTING_INTERNET_TETHERING,
                              APP_SETTING_Carrier,
                              APP_SETTING_NOTIFICATIONS_ID,
                              APP_SETTING_INTERNET_General,
                              APP_SETTING_About,
                              APP_SETTING_Keyboard,
                              APP_SETTING_ACCESSIBILITY,
                              APP_SETTING_INTERNET_INTERNATIONAL,
                              APP_SETTING_Wallpaper,
                              APP_SETTING_SIRI,
                              APP_SETTING_Privacy,
                              APP_SETTING_SAFARI,
                              APP_SETTING_MUSIC,
                              APP_SETTING_MUSICEQ,
                              APP_SETTING_Photos,
                              APP_SETTING_INTERNET_FACETIME];
    }
    return _settingTypeArray;
}
@end
